/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */

 const path = require('path');
 const root = path.resolve(__dirname, '..');
 const exclusionList = require('metro-config/src/defaults/exclusionList');
const pkg = require('../package.json');

const modules = [...Object.keys({
  ...pkg.dependencies,
  ...pkg.peerDependencies,
})];

const blockList = exclusionList(
  modules.map(m => path.join(root, 'node_modules', m))
);

const extraNodeModules = modules.reduce((acc, name) => {
  acc[name] = path.join(__dirname, 'node_modules', name);
  return acc;
}, {});

module.exports = {
  projectRoot: __dirname,
  watchFolders: [root],
  resolver: {
    blockList,
    extraNodeModules,
  },
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};
